package com.tengju.data.domain.model.activity;

import lombok.AllArgsConstructor;

/**
 * @author: 大木
 * @date: 2021/10/15 8:44 下午
 */
@AllArgsConstructor
public enum SubjectType {

    BRAND(10, "品牌"),
    PACKAGE(20, "套组"),
    GIFT(30, "礼包"),
    ALL(40, "全部"),
    ;

    private final Integer val;
    private final String desc;

    public Integer getVal() {
        return val;
    }

    public String getDesc() {
        return desc;
    }

    public static SubjectType fromVal(Integer val) {
        for (SubjectType type : values()) {
            if (type.val.equals(val)) {
                return type;
            }
        }
        return null;
    }


    public static SubjectType fromName(String name) {
        for (SubjectType type : values()) {
            if (type.name().equals(name)) {
                return type;
            }
        }
        return null;
    }

}
